﻿<Workspace x:Name="grammar_Thai"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
  xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
  xmlns="clr-namespace:agree;assembly=agree-sys"
  xmlns:cfg="clr-namespace:agree.configuration;assembly=agree-sys"
  xmlns:semi="clr-namespace:agree.semi;assembly=agree-sys">

    <Workspace.DefaultDirectories>
        <StringItem>grammars</StringItem>
        <StringItem>grammars\thai</StringItem>
        <StringItem>grammars\thai\lkb</StringItem>
    </Workspace.DefaultDirectories>

    <Grammar x:Name="thai"
             DisplayName="Thai Grammar"
             Author="Glenn Slayden"
             ItemCulture="th-TH">
        <Grammar.AgreeConfig>
            <cfg:AgreeConfig x:Name="thai_config" Loader="{cfg:LkbConfigLoader globals.lsp;mrsglobals.lisp}" />
        </Grammar.AgreeConfig>
    </Grammar>

    <TdlGroup x:Name="thai_TdlGroup">
        <Tdl Content="{ReadFile matrix.tdl}" />
        <Tdl Content="{ReadFile head-types.tdl}" />
        <Tdl Content="{ReadFile thai.tdl}" />
        <Tdl Content="{ReadFile tmt.tdl}" />
        <Tdl Content="{ReadFile rules.tdl}" TdlType="SyntaxRule"/>
        <!--<Tdl Content="{ReadFile lexicon.tdl}" TdlType="LexicalEntry" />-->
        <Tdl Content="{ReadFile lexicon-575-mrs.tdl}" TdlType="LexicalEntry" />
        <Tdl Content="{ReadFile labels.tdl}" TdlType="NodeLabel" />
        <Tdl Content="{ReadFile roots.tdl}" TdlType="StartSymbol" />
        <Tdl Content="{ReadFile trigger.mtr}" TdlType="TriggerRule" />
        <Tdl Content="{ReadFile tmr/uniscribe.tdl}" TdlType="TokenMappingRule" />
    </TdlGroup >

    <TdlTokenizerFactory x:Name="tok_functor" AgreeConfig="{x:Reference thai_config}" />

    <TypeDictionary x:Name="thai_td" Grammar="{x:Reference thai}" />

    <TypeLattice x:Name="thai_bcpo">
        <TypeGraphFinalizer>
            <TypeDictionaryLoader TypeDictionary="{x:Reference thai_td}">
                <TdlConstraintGrouper TdlType="Type">
                    <TdlHashAggregator Functor="{x:Reference tok_functor}">
                        <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.Type}}">
                            <x:Reference Name="thai_TdlGroup" />
                        </Where>
                    </TdlHashAggregator>
                </TdlConstraintGrouper>
            </TypeDictionaryLoader>
        </TypeGraphFinalizer>
    </TypeLattice>

    <FeatMgr x:Name="thai_ftm" TypeLattice="{x:Reference thai_bcpo}" />

    <GlbCache x:Name="thai_glbc" FeatMgr="{x:Reference thai_ftm}" />

    <TypeUtils x:Name="thai_tu" GlbCache="{x:Reference thai_glbc}" />

    <Isometrics x:Name="thai_im" TypeUtils="{x:Reference thai_tu}" />

    <TfsUnifier x:Name="thai_u" Isometrics="{x:Reference thai_im}" />

    <MrsManager x:Name="thai_mrsm" Isometrics="{x:Reference thai_im}" />

    <PropertyRef Item="{x:Reference thai}" Path="SemI">
        <semi:SemI x:Name="thai_semi" PredicateArgs="{semi:PredicateArgsLoader core.smi}">
            <semi:SemI.Vpm>
                <semi:Vpm Loader="{semi:VpmLoader semi.vpm}" />
            </semi:SemI.Vpm>
        </semi:SemI>
    </PropertyRef>

    <EntryMgr x:Name="thai_em"
              TfsUnifier="{x:Reference thai_u}"
              MrsManager="{x:Reference thai_mrsm}"
              DefaultTokenizer="{x:Static SplitTokenizer.SpaceCharTokenizer}">

        <EntryMgr.SyntaxRuleTokenGroups>
            <TdlConstraintGrouper TdlType="SyntaxRule">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.SyntaxRule}}" >
                        <x:Reference Name="thai_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.SyntaxRuleTokenGroups>

        <EntryMgr.LexicalEntryTokenGroups>
            <TdlConstraintGrouper TdlType="LexicalEntry">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.LexicalEntry}}">
                        <x:Reference Name="thai_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.LexicalEntryTokenGroups>

        <EntryMgr.NodeLabelTokenGroups>
            <TdlConstraintGrouper TdlType="NodeLabel">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.NodeLabel}}">
                        <x:Reference Name="thai_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.NodeLabelTokenGroups>

        <EntryMgr.TriggerRuleTokenGroups>
            <TdlConstraintGrouper TdlType="TriggerRule">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.TriggerRule}}">
                        <x:Reference Name="thai_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.TriggerRuleTokenGroups>

        <EntryMgr.StartSymbolTokenGroups>
            <TdlConstraintGrouper TdlType="StartSymbol">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.StartSymbol}}">
                        <x:Reference Name="thai_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.StartSymbolTokenGroups>

        <EntryMgr.TokenMappingRuleTokenGroups>
            <TdlConstraintGrouper TdlType="TokenMappingRule">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.TokenMappingRule}}">
                        <x:Reference Name="thai_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.TokenMappingRuleTokenGroups>

        <EntryMgr.LexicalFilteringRuleTokenGroups>
            <TdlConstraintGrouper TdlType="LexicalFilteringRule">
                <TdlHashAggregator Functor="{x:Reference tok_functor}">
                    <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.LexicalFilteringRule}}">
                        <x:Reference Name="thai_TdlGroup" />
                    </Where>
                </TdlHashAggregator>
            </TdlConstraintGrouper>
        </EntryMgr.LexicalFilteringRuleTokenGroups>

    </EntryMgr>

    <NodeLabeler x:Name="thai_nl"
                 EntryMgr="{x:Reference thai_em}"
         TfsUnifier="{x:Reference thai_u}" />

    <TriggerRuleMgr x:Name="thai_trm"
                 EntryMgr="{x:Reference thai_em}" />

    <RuleCompatibiltyCache EntryMgr="{x:Reference thai_em}" Enable="True" />

    <Lexicon x:Name="thai_lex"
             EntryMgr="{x:Reference thai_em}" />

    <QuickCheck x:Name="thai_qc"
                    TypeUtils="{x:Reference thai_tu}"
                    Paths="{ReadFileLines grammars/thai/20130515-qc.txt}" />

</Workspace>
